using PKGames.Analytics;

namespace PKGames.Voxel.Analytics
{
	public class NpcInteractionEvent : AnalyticsEvent
	{
		private readonly string _npcType;

		private int _interactionCount = 1;

		private const string EventName = "npc_interaction";

		private const string NpcTypeKey = "npcType";

		private const string LevelNameKey = "levelName";

		private const string InteractionCountKey = "interactionCount";

		private const int EventRevision = 0;

		protected override int Flags => 3;

		protected override string Name => "npc_interaction";

		protected override int Revision => 0;

		public NpcInteractionEvent(string levelName, string npcType)
		{
			_npcType = npcType;
			base.Parameters["levelName"] = new UnityEncodedPrimitiveData(levelName);
		}

		public void NpcInteracted()
		{
			_interactionCount++;
		}

		public override void Finish()
		{
			base.Parameters["npcType"] = new UnityEncodedPrimitiveData(_npcType);
			base.Parameters["interactionCount"] = new UnityEncodedPrimitiveData(_interactionCount);
		}
	}
}
